home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / serial / callback.001 / callback~ / callback / login / getdestination.c < prev    next >
C/C++ Source or Header  |  1996-08-02  |  870b  |  36 lines

  1.  
  2. #include "cblogin.h"
  3.  
  4. int get_destination(int uid)
  5. {
  6.     char
  7.         where[30];                /* buffer for destination */
  8.     int
  9.     dest;
  10.         
  11.     printf("----------------------------------\n"
  12.        "Enter the callback-destination for %s: ", username(uid));
  13.  
  14.  
  15.     if (!getbuf(where, 30))            /* read input (return max 30) */
  16.     {                                       /* no input: reset to enable */
  17.     log(log_on, "Callback cancelled by %s", username(uid));
  18.     puts("Callback cancelled");        /* reset the file and exit */
  19.         enable_state();                     
  20.     exit (1);
  21.     }
  22.     
  23.  
  24.     if ((dest = combine(uid, where)) == -1) /* invalid callback name ? */
  25.     {
  26.     log(log_default, "Invalid destination '%s' requested by %s",
  27.             where,
  28.             username(uid));
  29.     printf("Can't callback %s at %s\n", username(uid), where);
  30.     enable_state();
  31.     exit (1);
  32.     }
  33.  
  34.     return (dest);
  35. }
  36.